import axios from 'axios';
axios.interceptors.request.use(config => {
    config.headers['Authorization'] = 'bearer ' + localStorage.getItem("token");
    return config;
});
axios.interceptors.response.use(response => {
    return response;
}, error => {
    if (error.response.status === 401) {
        window.location = "/login";
    }
    return Promise.reject(error.response.data);
})

export default axios;
// 代理路径
export let url = "/api";
